#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <queue>
using namespace std;

const int N = 1e5 + 10;
int n, k;
int a[N];

int main() {
    cin >> n >> k;
    priority_queue<int, vector<int>, greater<int>> heap;
    //priority_queue<int, > heap;
    for (int i = 0; i < n; ++i) {
        int t;
        cin >> t;
        heap.push(t);
    }
    int sum = 0, ret = 0;
    while (sum < k) {
        int tmp = heap.top();
        heap.pop();
        sum += tmp;
        if (sum < k) ++ret;
        heap.push(tmp * 2);
    }
    cout << ret;
}
